#include "GError.h"
#include "GParallel.h"
#include "GTaskManager.h"
#include "GWorkerThread.h"
#include "GParallelForTask.h"
#include "GParallelForInternal.h"

namespace GEngine
{

	void GParallel::For(GParallelForTask* ForTask, const GTaskRange& ForRange)
	{
		GTaskResult	ForResult;
		GParallelForInternal* ParallelFor = new GParallelForInternal(&ForResult, ForTask, ForRange);
		mGTaskManager->Schedule(ParallelFor, mGCurrentWorkerId);
		mGTaskManager->BusyWait(&ForResult);
	}


	void GParallel::Sort(GParallelSortTask* ForTask, const GTaskRange& ForRange)
	{
		GUtil::GError::Error("Not Implemented Yet.");
	}

}